home *** CD-ROM | disk | FTP | other *** search
- ;char get_scan();
-
- EXTRN _memory_model:byte
-
- _TEXT SEGMENT BYTE PUBLIC 'CODE'
- ASSUME CS:_TEXT
- PUBLIC _get_scan
- _get_scan proc near
- mov dx,0ffh ;assume no keystroke
- mov ah,1 ;BIOS func to chk buffer
- int 16h ;chk for keystroke
- jz L4 ;jump if buffer empty
- mov dl,ah ;assume ASCII code
- or al,al ;test for extended code
- jnz L4 ;jump if ASCII code
- cmp ah,84 ;test for func+shift keys
- jb L3 ;jump ahead if below
- cmp ah,94 ;test if Func + Shift
- jnb L1 ;jump ahead if not
- sub ah,25 ;figure the scan code
- jmp short L3 ;jump ahead and adjust
- L1: cmp ah,104 ;test if Func + Ctrl
- jnb L2 ;jump ahead if not
- sub ah,35 ;figure the scan code
- jmp short L3 ;jump ahead and adjust
- L2: cmp ah,114 ;test if Func + Alt
- jnb L3 ;jump ahead if not
- sub ah,45 ;figure the scan code
- L3: add ah,128 ;add 128 to extended code
- mov dl,ah ;move value to DL
- L4: mov al,dl ;set for return
- cmp _memory_model,0 ;quit
- jle quit ;
- db 0CBh ;RET far
- quit: ret ;RET near
- _get_scan ENDP
- _TEXT ENDS
- END